# -*- coding:utf-8 -*-
"""
这里对图片进行，旋转，缩放，翻转，扭曲等操作

"""
from PIL import Image
import rembg


# 对图片进行翻转    

def flip_image(img_path):
    img = Image.open(img_path)  
    return img.transpose(Image.FLIP_LEFT_RIGHT)

# 旋转图片  
def rotate_image(img_path,rotation):
    img = Image.open(img_path)
    return img.rotate(rotation)

# 缩放图片
def img_resize(img:Image.Image,size:tuple):

    new_img = img.resize(size)
    return new_img


# 把图片进行扭曲
def img_distort(img_path):
    img = Image.open(img_path)
    return img.transform(img.size,Image.AFFINE,(1,0,0,1,0,0))

# 移除背景
def remove_bg(img_path):
    img = Image.open(img_path)
    return rembg.remove(img)


